#include<iostream>
using namespace std;
class Product
{
public:
	virtual ~Product() = 0
	{
	}
protected:
	Product()
	{
	}
};
class ConcreteProduct:public Product
{
public:
	ConcreteProduct()//:Product()
	{
		cout<<"ConcreteProduct..."<<endl;
	}
	~ConcreteProduct()
	{
	}
};

class Factory
{
public:
	virtual ~Factory() = 0
	{
	}
	virtual Product* CreateProduct() = 0;
protected:
	Factory()
	{
	}
};

class ConcreteFactory:public Factory
{
public:
	~ConcreteFactory()
	{
	}

	ConcreteFactory()
	{
		cout<<"ConcreteFactory....."<<endl;
	}

	Product* CreateProduct()
	{
		return new ConcreteProduct();
	}
};

int main(int argc,char* argv[])
{
	Factory* fac = new ConcreteFactory();
	Product* p = fac->CreateProduct();
	return 0;
}